//JavaScript Framework 2.0 Code
try {
	Type.registerNamespace('com.yonyou.ncmm_pac_pda.WrScanListPageController');
	com.yonyou.ncmm_pac_pda.WrScanListPageController = function() {
		com.yonyou.ncmm_pac_pda.WrScanListPageController.initializeBase(this);
		this.initialize();
	}
	function com$yonyou$ncmm_pac_pda$WrScanListPageController$initialize() {
		//you can programing by $ctx API
		//get the context data through $ctx.get()
		//set the context data through $ctx.push(json)
		//set the field of the context through $ctx.put(fieldName, fieldValue)
		//get the parameter of the context through $ctx.param(parameterName)
		//Demo Code:
		//    var str = $ctx.getString();      //获取当前Context对应的字符串
		//    alert($ctx.getString())          //alert当前Context对应的字符串
		//    var json = $ctx.getJSONObject(); //获取当前Context，返回值为json
		//    json["x"] = "a";        //为当前json增加字段
		//    json["y"] = [];           //为当前json增加数组
		//    $ctx.push(json);            //设置context，并自动调用数据绑定
		//
		//    put方法需手动调用databind()
		//    var x = $ctx.get("x");    //获取x字段值
		//    $ctx.put("x", "b");     //设置x字段值
		//    $ctx.put("x", "b");     //设置x字段值
		//    $ctx.databind();            //调用数据绑定才能将修改的字段绑定到控件上
		//    var p1 = $param.getString("p1");   //获取参数p2的值，返回一个字符串
		//    var p2 = $param.getJSONObject("p2");   //获取参数p3的值，返回一个JSON对象
		//    var p3 = $param.getJSONArray("p3");   //获取参数p1的值，返回一个数组

		//your initialize code below...

	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$evaljs(js) {
		eval(js)
	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$button3_onclick(sender, args) {

	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$button4_onclick(sender, args) {

	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$button5_onclick(sender, args) {

	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$imagebutton0_onclick(sender, args) {
		// 点击按钮弹出浮动菜单
		$menu.openDropDownList({
			"controlid" : "imagebutton0",
			"dropDownListWidth" : "130",
			"background" : "#2e2e2e",
			"color" : "#ffffff",
			"font-size" : "15",
			"halign" : "center",
			"split-color" : "#eeeeee",
			"panelstyle" : "round-div",
			"border-color" : "#d2d2d2",
			"showtype" : "right",
			"dropItemsArray" : [{
				"name" : "主界面",
				"action" : "menu1_click()"
			}, {
				"name" : "数据管理",
				"action" : "menu2_click()"
			}, {
				"name" : "业务设置",
				"action" : "menu3_click()"
			}, {
				"name" : "注销",
				"action" : "menu4_click()"
			}, {
				"name" : "退出",
				"action" : "menu5_click()"
			}]
		})
	}

	function menu1_click() {
		// 跳转到主界面
		$view.open({
			viewid : "com.yonyou.ncmm_pac_pda.LoginPage", //主界面id
			isKeep : "false"//
		})
	}

	function menu2_click() {
		// 跳转到数据管理界面
		$view.open({
			viewid : "com.yonyou.ncmm_pac_pda.DM_main",
			isKeep : "false"//
		})
	}

	function menu3_click() {
		// 跳转到业务设置界面
		$view.open({
			viewid : "com.yonyou.ncmm_pac_pda.LoginSettingPage",
			isKeep : "false"//
		})
	}

	function menu4_click() {
		// 跳转到登录界面
		$view.open({
			viewid : "com.yonyou.ncmm_pac_pda.LoginPage", //主界面id
			isKeep : "false"//
		})
	}

	function menu5_click() {
		// 关闭app
	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$onload(sender, args) {
		var json = {
			list : [{
				"billcode" : "001",
				"rowno" : "10",
				"material" : "m001",
				"wrnum" : 100,
				"wrastnum" : 100,
				"actualenddate" : "2016-10-12 15:30:50"
			}, {
				"billcode" : "002",
				"rowno" : "10",
				"material" : "m002",
				"wrnum" : 200,
				"wrastnum" : 200,
				"actualenddate" : "2016-10-12 15:30:50"
			}, {
				"billcode" : "003",
				"rowno" : "10",
				"material" : "m003",
				"wrnum" : 300,
				"wrastnum" : 300,
				"actualenddate" : "2016-10-12 15:30:50"
			}, {
				"billcode" : "004",
				"rowno" : "10",
				"material" : "m004",
				"wrnum" : 400,
				"wrastnum" : 400,
				"actualenddate" : "2016-10-12 15:30:50"
			}, {
				"billcode" : "005",
				"rowno" : "10",
				"material" : "m005",
				"wrnum" : 500,
				"wrastnum" : 500,
				"actualenddate" : "2016-10-12 15:30:50"
			}, {
				"billcode" : "006",
				"rowno" : "10",
				"material" : "m006",
				"wrnum" : 600,
				"wrastnum" : 600,
				"actualenddate" : "2016-10-12 15:30:50"
			}, {
				"billcode" : "007",
				"rowno" : "10",
				"material" : "m007",
				"wrnum" : 700,
				"wrastnum" : 700,
				"actualenddate" : "2016-10-12 15:30:50"
			}, {
				"billcode" : "008",
				"rowno" : "10",
				"material" : "m008",
				"wrnum" : 800,
				"wrastnum" : 800,
				"actualenddate" : "2016-10-12 15:30:50"
			}, {
				"billcode" : "009",
				"rowno" : "10",
				"material" : "m009",
				"wrnum" : 900,
				"wrastnum" : 900,
				"actualenddate" : "2016-10-12 15:30:50"
			}, {
				"billcode" : "010",
				"rowno" : "10",
				"material" : "m010",
				"wrnum" : 1000,
				"wrastnum" : 1000,
				"actualenddate" : "2016-10-12 15:30:50"
			}]
		};
		$ctx.push(json);
	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$button2_onclick(sender, args) {

	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$checkbox0_onchange(sender, args) {
		// 全选逻辑
		$ctx.dataCollect();
		var ischecked = $id(sender).get("checked");
		var list = $ctx.getJSONArray("list");
		for (var i = 0; i < list.length; i++) {
			list[i]["ischecked"] = ischecked;
		}

		var json = {};
		json["list"] = list;
		json["isallchecked"] = ischecked;
		$ctx.push(json);

	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$button0_onclick(sender, args) {
		$view.close();

	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$checkbox1_onchange(sender, args) {
		// 单选逻辑
		$ctx.dataCollect();
		var ischecked = $id(sender).get("checked");
		var isallchecked = true;
		if (ischecked == false) {
			isallchecked = false;
		} else {
			var orders = $ctx.getJSONArray("list");
			for (var i = 0; i < orders.length; i++) {
				if (orders[i]["ischecked"] == null || orders[i]["ischecked"] == "false") {
					isallchecked = false;
					break;
				}
			}
		}

		var json = {};
		json["list"] = orders;
		json["isallchecked"] = isallchecked;
		$ctx.push(json);
	}

	function com$yonyou$ncmm_pac_pda$WrScanListPageController$onitemclick(sender, args) {
		// 获取当前行内容
		var row = $id("wlistviewdefine0").get("row");
		row = $stringToJSON(row);
		// 生产报告id
		var wrid = row.wrid;
		// 单击行跳转到详情页面
		$view.open({
			"viewid" : "com.yonyou.ncmm_pac_pda.WrScanDetailPage",
			"isKeep" : "true",
			// "id" : wrid
			"row" : row
		});
	}


	com.yonyou.ncmm_pac_pda.WrScanListPageController.prototype = {
		onitemclick : com$yonyou$ncmm_pac_pda$WrScanListPageController$onitemclick,
		checkbox1_onchange : com$yonyou$ncmm_pac_pda$WrScanListPageController$checkbox1_onchange,
		button0_onclick : com$yonyou$ncmm_pac_pda$WrScanListPageController$button0_onclick,
		checkbox0_onchange : com$yonyou$ncmm_pac_pda$WrScanListPageController$checkbox0_onchange,
		button2_onclick : com$yonyou$ncmm_pac_pda$WrScanListPageController$button2_onclick,
		onload : com$yonyou$ncmm_pac_pda$WrScanListPageController$onload,
		imagebutton0_onclick : com$yonyou$ncmm_pac_pda$WrScanListPageController$imagebutton0_onclick,
		button5_onclick : com$yonyou$ncmm_pac_pda$WrScanListPageController$button5_onclick,
		button4_onclick : com$yonyou$ncmm_pac_pda$WrScanListPageController$button4_onclick,
		button3_onclick : com$yonyou$ncmm_pac_pda$WrScanListPageController$button3_onclick,
		initialize : com$yonyou$ncmm_pac_pda$WrScanListPageController$initialize,
		evaljs : com$yonyou$ncmm_pac_pda$WrScanListPageController$evaljs
	};
	com.yonyou.ncmm_pac_pda.WrScanListPageController.registerClass('com.yonyou.ncmm_pac_pda.WrScanListPageController', UMP.UI.Mvc.Controller);
} catch(e) {
	$e(e);
}

